﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using ibba.agil.monitor.proxy;
using Winsoft.Framework.MonitorProxy;

namespace ibba.agil.core.common
{
    public class BusinessException : Exception
    {
        private string CustomMsg { get; set; }
        private string Operation { get; set; } 

        public BusinessException(string operation, string customMessage, Exception e)
            : base(customMessage,e)
        {
            CustomMsg = customMessage;
            Operation = operation;
            var monitor = MonitorClientFactory.Create();
            monitor.TraceWarning(new MonitorData { OperationName = Operation, TraceMessage = base.Message + " >> " + base.StackTrace });
        }

        public override string Message
        {
            get
            {
                return CustomMsg;
            }
        }
    }
}
